package com.googlecode.kipler.container.dl;

import java.util.HashMap;
import java.util.Map;

import com.googlecode.kipler.common.Copyable;
import com.googlecode.kipler.syntax.formula.Formula;

public class LabelManager implements Copyable<LabelManager> {
	private Map<Formula, Boolean> labels = new HashMap<Formula, Boolean>();

	public void setLabel(Formula f, boolean left) {
		labels.put(f, left);
	}

	public boolean isLeftDerived(Formula f) {
		return labels.get(f).booleanValue();
	}

	public void copyLabel(Formula from, Formula to) {
		labels.put(to, isLeftDerived(from));
	}

	@Override
	public LabelManager copy() {
		LabelManager result = new LabelManager();
		result.labels = new HashMap<Formula, Boolean>(labels);
		return result;
	}

}
